{% extends "base.html" %}

{% block content %}
<div class="row">
    <div class="col-12">
        <h1 class="text-center mb-4">人才流失预测系统</h1>
        <p class="text-center text-muted">请输入员工信息以预测流失风险</p>
    </div>
</div>

<form method="POST" action="/predict">
    <div class="row">
        <!-- 基本信息 -->
        <div class="col-md-6">
            <div class="form-section">
                <h4 class="section-title">基本信息</h4>
                
                <div class="mb-3">
                    <label for="Age" class="form-label">年龄 (Age)</label>
                    <input type="number" class="form-control" id="Age" name="Age" value="{{ default_data.Age }}" required>
                </div>
                
                <div class="mb-3">
                    <label for="Gender" class="form-label">性别 (Gender)</label>
                    <select class="form-control" id="Gender" name="Gender">
                        <option value="Male" {% if default_data.Gender == 'Male' %}selected{% endif %}>男性</option>
                        <option value="Female" {% if default_data.Gender == 'Female' %}selected{% endif %}>女性</option>
                    </select>
                </div>
                
                <div class="mb-3">
                    <label for="MaritalStatus" class="form-label">婚姻状况 (MaritalStatus)</label>
                    <select class="form-control" id="MaritalStatus" name="MaritalStatus">
                        <option value="Single" {% if default_data.MaritalStatus == 'Single' %}selected{% endif %}>单身</option>
                        <option value="Married" {% if default_data.MaritalStatus == 'Married' %}selected{% endif %}>已婚</option>
                        <option value="Divorced" {% if default_data.MaritalStatus == 'Divorced' %}selected{% endif %}>离异</option>
                    </select>
                </div>
                
                <div class="mb-3">
                    <label for="Education" class="form-label">教育水平 (Education)</label>
                    <input type="number" class="form-control" id="Education" name="Education" min="1" max="5" value="{{ default_data.Education }}">
                </div>
                
                <div class="mb-3">
                    <label for="EducationField" class="form-label">教育领域 (EducationField)</label>
                    <select class="form-control" id="EducationField" name="EducationField">
                        <option value="Life Sciences" {% if default_data.EducationField == 'Life Sciences' %}selected{% endif %}>生命科学</option>
                        <option value="Medical" {% if default_data.EducationField == 'Medical' %}selected{% endif %}>医学</option>
                        <option value="Marketing" {% if default_data.EducationField == 'Marketing' %}selected{% endif %}>市场营销</option>
                        <option value="Technical Degree" {% if default_data.EducationField == 'Technical Degree' %}selected{% endif %}>技术学位</option>
                        <option value="Human Resources" {% if default_data.EducationField == 'Human Resources' %}selected{% endif %}>人力资源</option>
                        <option value="Other" {% if default_data.EducationField == 'Other' %}selected{% endif %}>其他</option>
                    </select>
                </div>
            </div>
        </div>
        
        <!-- 工作信息 -->
        <div class="col-md-6">
            <div class="form-section">
                <h4 class="section-title">工作信息</h4>
                
                <div class="mb-3">
                    <label for="Department" class="form-label">部门 (Department)</label>
                    <select class="form-control" id="Department" name="Department">
                        <option value="Research & Development" {% if default_data.Department == 'Research & Development' %}selected{% endif %}>研发部</option>
                        <option value="Sales" {% if default_data.Department == 'Sales' %}selected{% endif %}>销售部</option>
                        <option value="Human Resources" {% if default_data.Department == 'Human Resources' %}selected{% endif %}>人力资源部</option>
                    </select>
                </div>
                
                <div class="mb-3">
                    <label for="JobRole" class="form-label">职位 (JobRole)</label>
                    <select class="form-control" id="JobRole" name="JobRole">
                        <option value="Research Scientist" {% if default_data.JobRole == 'Research Scientist' %}selected{% endif %}>研究科学家</option>
                        <option value="Laboratory Technician" {% if default_data.JobRole == 'Laboratory Technician' %}selected{% endif %}>实验室技术员</option>
                        <option value="Research Director" {% if default_data.JobRole == 'Research Director' %}selected{% endif %}>研究总监</option>
                        <option value="Manufacturing Director" {% if default_data.JobRole == 'Manufacturing Director' %}selected{% endif %}>制造总监</option>
                        <option value="Healthcare Representative" {% if default_data.JobRole == 'Healthcare Representative' %}selected{% endif %}>医疗代表</option>
                        <option value="Manager" {% if default_data.JobRole == 'Manager' %}selected{% endif %}>经理</option>
                        <option value="Sales Executive" {% if default_data.JobRole == 'Sales Executive' %}selected{% endif %}>销售主管</option>
                        <option value="Sales Representative" {% if default_data.JobRole == 'Sales Representative' %}selected{% endif %}>销售代表</option>
                        <option value="Human Resources" {% if default_data.JobRole == 'Human Resources' %}selected{% endif %}>人力资源</option>
                    </select>
                </div>
                
                <div class="mb-3">
                    <label for="JobLevel" class="form-label">职位级别 (JobLevel)</label>
                    <input type="number" class="form-control" id="JobLevel" name="JobLevel" min="1" max="5" value="{{ default_data.JobLevel }}">
                </div>
                
                <div class="mb-3">
                    <label for="MonthlyIncome" class="form-label">月收入 (MonthlyIncome)</label>
                    <input type="number" class="form-control" id="MonthlyIncome" name="MonthlyIncome" value="{{ default_data.MonthlyIncome }}">
                </div>
                
                <div class="mb-3">
                    <label for="BusinessTravel" class="form-label">出差频率 (BusinessTravel)</label>
                    <select class="form-control" id="BusinessTravel" name="BusinessTravel">
                        <option value="Non-Travel" {% if default_data.BusinessTravel == 'Non-Travel' %}selected{% endif %}>不出差</option>
                        <option value="Travel_Rarely" {% if default_data.BusinessTravel == 'Travel_Rarely' %}selected{% endif %}>偶尔出差</option>
                        <option value="Travel_Frequently" {% if default_data.BusinessTravel == 'Travel_Frequently' %}selected{% endif %}>经常出差</option>
                    </select>
                </div>
            </div>
        </div>
    </div>
    
    <div class="row">
        <!-- 工作年限 -->
        <div class="col-md-6">
            <div class="form-section">
                <h4 class="section-title">工作年限</h4>
                
                <div class="mb-3">
                    <label for="TotalWorkingYears" class="form-label">总工作年限 (TotalWorkingYears)</label>
                    <input type="number" class="form-control" id="TotalWorkingYears" name="TotalWorkingYears" value="{{ default_data.TotalWorkingYears }}">
                </div>
                
                <div class="mb-3">
                    <label for="YearsAtCompany" class="form-label">在公司年数 (YearsAtCompany)</label>
                    <input type="number" class="form-control" id="YearsAtCompany" name="YearsAtCompany" value="{{ default_data.YearsAtCompany }}">
                </div>
                
                <div class="mb-3">
                    <label for="YearsInCurrentRole" class="form-label">在当前角色年数 (YearsInCurrentRole)</label>
                    <input type="number" class="form-control" id="YearsInCurrentRole" name="YearsInCurrentRole" value="{{ default_data.YearsInCurrentRole }}">
                </div>
                
                <div class="mb-3">
                    <label for="YearsSinceLastPromotion" class="form-label">上次晋升以来年数 (YearsSinceLastPromotion)</label>
                    <input type="number" class="form-control" id="YearsSinceLastPromotion" name="YearsSinceLastPromotion" value="{{ default_data.YearsSinceLastPromotion }}">
                </div>
                
                <div class="mb-3">
                    <label for="YearsWithCurrManager" class="form-label">与当前经理共事年数 (YearsWithCurrManager)</label>
                    <input type="number" class="form-control" id="YearsWithCurrManager" name="YearsWithCurrManager" value="{{ default_data.YearsWithCurrManager }}">
                </div>
                
                <div class="mb-3">
                    <label for="NumCompaniesWorked" class="form-label">工作过的公司数量 (NumCompaniesWorked)</label>
                    <input type="number" class="form-control" id="NumCompaniesWorked" name="NumCompaniesWorked" value="{{ default_data.NumCompaniesWorked }}">
                </div>
            </div>
        </div>
        
        <!-- 满意度和绩效 -->
        <div class="col-md-6">
            <div class="form-section">
                <h4 class="section-title">满意度和绩效</h4>
                
                <div class="mb-3">
                    <label for="EnvironmentSatisfaction" class="form-label">环境满意度 (EnvironmentSatisfaction)</label>
                    <select class="form-control" id="EnvironmentSatisfaction" name="EnvironmentSatisfaction">
                        <option value="1" {% if default_data.EnvironmentSatisfaction == 1 %}selected{% endif %}>1 - 非常不满意</option>
                        <option value="2" {% if default_data.EnvironmentSatisfaction == 2 %}selected{% endif %}>2 - 不满意</option>
                        <option value="3" {% if default_data.EnvironmentSatisfaction == 3 %}selected{% endif %}>3 - 满意</option>
                        <option value="4" {% if default_data.EnvironmentSatisfaction == 4 %}selected{% endif %}>4 - 非常满意</option>
                    </select>
                </div>
                
                <div class="mb-3">
                    <label for="JobSatisfaction" class="form-label">工作满意度 (JobSatisfaction)</label>
                    <select class="form-control" id="JobSatisfaction" name="JobSatisfaction">
                        <option value="1" {% if default_data.JobSatisfaction == 1 %}selected{% endif %}>1 - 非常不满意</option>
                        <option value="2" {% if default_data.JobSatisfaction == 2 %}selected{% endif %}>2 - 不满意</option>
                        <option value="3" {% if default_data.JobSatisfaction == 3 %}selected{% endif %}>3 - 满意</option>
                        <option value="4" {% if default_data.JobSatisfaction == 4 %}selected{% endif %}>4 - 非常满意</option>
                    </select>
                </div>
                
                <div class="mb-3">
                    <label for="RelationshipSatisfaction" class="form-label">关系满意度 (RelationshipSatisfaction)</label>
                    <select class="form-control" id="RelationshipSatisfaction" name="RelationshipSatisfaction">
                        <option value="1" {% if default_data.RelationshipSatisfaction == 1 %}selected{% endif %}>1 - 非常不满意</option>
                        <option value="2" {% if default_data.RelationshipSatisfaction == 2 %}selected{% endif %}>2 - 不满意</option>
                        <option value="3" {% if default_data.RelationshipSatisfaction == 3 %}selected{% endif %}>3 - 满意</option>
                        <option value="4" {% if default_data.RelationshipSatisfaction == 4 %}selected{% endif %}>4 - 非常满意</option>
                    </select>
                </div>
                
                <div class="mb-3">
                    <label for="JobInvolvement" class="form-label">工作投入度 (JobInvolvement)</label>
                    <select class="form-control" id="JobInvolvement" name="JobInvolvement">
                        <option value="1" {% if default_data.JobInvolvement == 1 %}selected{% endif %}>1 - 低</option>
                        <option value="2" {% if default_data.JobInvolvement == 2 %}selected{% endif %}>2 - 中等</option>
                        <option value="3" {% if default_data.JobInvolvement == 3 %}selected{% endif %}>3 - 高</option>
                        <option value="4" {% if default_data.JobInvolvement == 4 %}selected{% endif %}>4 - 非常高</option>
                    </select>
                </div>
                
                <div class="mb-3">
                    <label for="WorkLifeBalance" class="form-label">工作生活平衡 (WorkLifeBalance)</label>
                    <select class="form-control" id="WorkLifeBalance" name="WorkLifeBalance">
                        <option value="1" {% if default_data.WorkLifeBalance == 1 %}selected{% endif %}>1 - 非常差</option>
                        <option value="2" {% if default_data.WorkLifeBalance == 2 %}selected{% endif %}>2 - 差</option>
                        <option value="3" {% if default_data.WorkLifeBalance == 3 %}selected{% endif %}>3 - 好</option>
                        <option value="4" {% if default_data.WorkLifeBalance == 4 %}selected{% endif %}>4 - 非常好</option>
                    </select>
                </div>
                
                <div class="mb-3">
                    <label for="PerformanceRating" class="form-label">绩效评级 (PerformanceRating)</label>
                    <select class="form-control" id="PerformanceRating" name="PerformanceRating">
                        <option value="3" {% if default_data.PerformanceRating == 3 %}selected{% endif %}>3 - 良好</option>
                        <option value="4" {% if default_data.PerformanceRating == 4 %}selected{% endif %}>4 - 优秀</option>
                    </select>
                </div>
            </div>
        </div>
    </div>
    
    <div class="row">
        <!-- 其他信息 -->
        <div class="col-md-6">
            <div class="form-section">
                <h4 class="section-title">其他信息</h4>
                
                <div class="mb-3">
                    <label for="DistanceFromHome" class="form-label">距离家庭的距离 (DistanceFromHome)</label>
                    <input type="number" class="form-control" id="DistanceFromHome" name="DistanceFromHome" value="{{ default_data.DistanceFromHome }}">
                </div>
                
                <div class="mb-3">
                    <label for="TrainingTimesLastYear" class="form-label">去年培训次数 (TrainingTimesLastYear)</label>
                    <input type="number" class="form-control" id="TrainingTimesLastYear" name="TrainingTimesLastYear" value="{{ default_data.TrainingTimesLastYear }}">
                </div>
                
                <div class="mb-3">
                    <label for="StockOptionLevel" class="form-label">股票期权级别 (StockOptionLevel)</label>
                    <select class="form-control" id="StockOptionLevel" name="StockOptionLevel">
                        <option value="0" {% if default_data.StockOptionLevel == 0 %}selected{% endif %}>0 - 无</option>
                        <option value="1" {% if default_data.StockOptionLevel == 1 %}selected{% endif %}>1 - 低</option>
                        <option value="2" {% if default_data.StockOptionLevel == 2 %}selected{% endif %}>2 - 中</option>
                        <option value="3" {% if default_data.StockOptionLevel == 3 %}selected{% endif %}>3 - 高</option>
                    </select>
                </div>
                
                <div class="mb-3">
                    <label for="PercentSalaryHike" class="form-label">薪资涨幅百分比 (PercentSalaryHike)</label>
                    <input type="number" class="form-control" id="PercentSalaryHike" name="PercentSalaryHike" value="{{ default_data.PercentSalaryHike }}">
                </div>
            </div>
        </div>
        
        <!-- 加班信息 -->
        <div class="col-md-6">
            <div class="form-section">
                <h4 class="section-title">加班信息</h4>
                
                <div class="mb-3">
                    <label for="OverTime" class="form-label">是否加班 (OverTime)</label>
                    <select class="form-control" id="OverTime" name="OverTime">
                        <option value="Yes" {% if default_data.OverTime == 'Yes' %}selected{% endif %}>是</option>
                        <option value="No" {% if default_data.OverTime == 'No' %}selected{% endif %}>否</option>
                    </select>
                </div>
                
                <div class="mb-3">
                    <label for="EmployeeNumber" class="form-label">员工编号 (EmployeeNumber)</label>
                    <input type="number" class="form-control" id="EmployeeNumber" name="EmployeeNumber" value="{{ default_data.EmployeeNumber }}">
                </div>
            </div>
        </div>
    </div>
    
    <div class="row">
        <div class="col-12 text-center">
            <button type="submit" class="btn btn-primary btn-lg">预测流失风险</button>
        </div>
    </div>
</form>
{% endblock %}
